-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create general PoolingOp and decompose to MaxPool2d #1154
Conversation
ac10e4e
to
bb05d0c
Compare
5665196
to
21e4b35
Compare
aa08eb0
to
25fee5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments inline
lib/Conversion/TTIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp
Outdated
Show resolved
Hide resolved
f55ca0d
to
68084e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime changes look good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for packing the reshapes to the conversion itself, that makes it a lot cleaner!
Requesting changes for the following reasons:
- replaceAllUsesWith needs to be removed
- in more than one file, I've seen a mix of camelCase and snake_case, can you please go over all the files and correct this?
- personally, I'd like to see more comments - pooling ops are among the most complicated to work with but with properly commented code, it gets easier :)
lib/Conversion/TTIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp
Outdated
Show resolved
Hide resolved
lib/Conversion/TTIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp
Outdated
Show resolved
Hide resolved
ttir::ConvolutionOp op, | ||
const std::vector<int64_t> ttnn_convolution_kernel_layout) { | ||
static std::vector<TransposeDims> | ||
generateTransposeIndicesLeftToRight(std::vector<int64_t> current_layout, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these transpose methods are hard to follow. A comment (with an example) above each method would make it much easier to come back to.
Additionally, it's somewhat noisy to keep these method in this file, can they be moved to a util file of sorts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've cleaned them up and removed a number of them. Also added comments.
41faf8a
to
4b23448
Compare
f392818
to
b5011ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding comments Lewis, I think it's much easier to follow what's going on now!
Approving, but please make sure to change snake_case to camelCase before merging.
* result at the end of the sequence | ||
*/ | ||
static Value | ||
generateTransposeSequence(Value input, PatternRewriter &rewriter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming generateTransposeSequence
to applyTransposeIndices
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think generateTransposeOps
might be better so that the fact its creating ops in the IR is explicit
lib/Conversion/TTIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp
Outdated
Show resolved
Hide resolved
lib/Conversion/TTIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp
Outdated
Show resolved
Hide resolved
maxpool2d Use output memory config attribute in runtime, add silicon tests
b5011ed
to
d36e4f2
Compare
ttir.max_pool2d
, the reshapes are now inserted upon conversion tottnn.max_pool2d
The PoolingOp is meant to closely resemble the
stablehlo.reduce_window
op. One of its features is that it can take any number of inputs and Pool them all simultaneously, and return a tuple with all the outputs. In the decomposition pass I convert this into multiple individual maxpool2d ops if need be. There is a test for this.